#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int triangleNumber(vector<int> &nums)
{
    sort(nums.begin(), nums.end());
    int len = nums.size();
    int cnt = 0;
    for (int i = 0; i < len - 2; i++)
    {
        int k = i + 1;
        for (int j = k + 1; j < len; j++)
        {
            if ((nums[i] + nums[k]) <= nums[j])
                k++;
            cnt++;
            cout << nums[i] << nums[k] << nums[j] << endl;
        }
    }
    cout << cnt <<endl;
    return cnt;
}

int main()
{
    vector<int> nums = {4,2,3,4};
    triangleNumber(nums);
    return 0;
}